<?php

/* @var $this yii\web\View */
use yii\helpers\Html;
use yii\helpers\Url;
use yii\grid\GridView;
//use app\models\Member;


$this->title = '会员信息查看';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="page-title">
  <div>
    <h1><i class="fa fa-users"></i> 查看和修改会员信息</h1>
    <ul class="breadcrumb side">
      <li><i class="fa fa-home fa-lg"></i></li>
      <li><a href="#">会员管理</a></li>
      <li class="active"><a href="#">查看和修改会员信息</a></li>
    </ul>
  </div>
  <div><a class="btn btn-info btn-flat" target='_blank' href='<?=Url::toRoute('site/downloaduserinfo')?>'><i class="fa fa-lg fa-download"></i> 下载全部会员信息到本地电脑</a></div>
</div>
<div class='card'>
<?php
//如何提前加载资源
echo GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
// 数据提供者中所含数据所定义的简单的列
// 使用的是模型的列的数据
'name',
'reg_date',
[
  'class' => 'yii\grid\ActionColumn',
  'header'=>'详细资料',
  'template'=>'{operate}',
  'buttons'=>[
      'operate'=> function ($url, $model, $key) {
                      return '<a href="'.Url::toRoute(['site/user','id'=>$model->id]).'" style="cursor:pointer;"><i class="fa fa-lg fa-user"></i></a>';
                  },
  ],
      // you may configure additional properties here
],

// 更复杂的列数据
/*[
  'class' => 'yii\grid\DataColumn', //由于是默认类型，可以省略
  'value' => function ($data) {
      return $data->name; // 如果是数组数据则为 $data['name'] ，例如，使用 SqlDataProvider 的情形。
  },
],*/
],

]);
?>
</div>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog modal-sm" role="document">
    <div class="modal-content">
      <div class="modal-header btn-warning">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel"><i class="fa fa-key"></i> 修改密码</h4>
      </div>
      <div class="modal-body">

        <form class="form-horizontal">
          <div class="form-group">
            <label class="control-label col-md-3">会员名</label>
            <div class="col-md-8">
              <input id='modifypw_user' class="form-control col-md-8" type="text" readonly="true" value="老虎">
            </div>
          </div>
          <div class="form-group">
            <label class="control-label col-md-3">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</label>
            <div class="col-md-8">
              <input id='modifypw_pw' class="form-control col-md-8" type="password" placeholder="请输入密码">
            </div>
          </div>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        <button id='modifypw_submit' type="button" class="btn btn-warning">确定</button>
      </div>
    </div>
  </div>
</div>
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-key="">
  <div class="modal-dialog modal-sm" role="document">
    <div class="modal-content">
      <div class="modal-header btn-warning">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel"><i class="fa fa-user-secret"></i> 设置会员登录权限</h4>
      </div>
      <div class="modal-body">

        <form class="form-horizontal">
          <div class="form-group">
            <label class="control-label col-md-3">会员名</label>
            <div class="col-md-8">
              <input id='modifyright_user' class="form-control col-md-8" type="text" readonly="true" value="老虎">
            </div>
          </div>
          <div class="form-group">
            <div class="animated-checkbox col-md-8 col-md-offset-3">
              <label>
                <input id='modifyright_login' type="checkbox"><span class="label-text">允许登录</span>
              </label>
            </div>
          </div>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        <button id='modifyright_submit' type="button" class="btn btn-warning">确定</button>
      </div>
    </div>
  </div>
</div>
